Requires Scripting PRO
Represents a method for authenticating with an SSH server. This class provides static methods for creating different types of SSH authentication strategies, including password-based, RSA key, ED25519, and ECDSA (P-256, P-384, P-521) private key authentication.
This class is essential when connecting to an SSH server using the SSHClient.connect() method.
static passwordBased(username: string, password: string): SSHAuthenticationMethodCreates a password-based authentication method.
username (string):
The username to use when logging into the SSH server.
password (string):
The password corresponding to the provided username.
SSHAuthenticationMethod configured for password-based login.static ras(username: string, sshRsa: Data, decryptionKey?: Data): SSHAuthenticationMethod | nullCreates an RSA private key–based authentication method.
username (string):
The username for SSH login.
sshRsa (Data):
The RSA private key in OpenSSH format. You can load the key using the Data.fromString() or similar method.
decryptionKey (Data, optional):
If the private key is encrypted, provide the decryption password as a Data object.
SSHAuthenticationMethod configured with RSA authentication, or null if the key is invalid.static ed25519(username: string, sshEd25519: Data, decryptionKey?: Data): SSHAuthenticationMethod | nullCreates an ED25519 private key–based authentication method.
username (string):
The SSH username.
sshEd25519 (Data):
The ED25519 private key content.
decryptionKey (Data, optional):
Optional decryption key if the private key is encrypted.
SSHAuthenticationMethod, or null if the key is not valid.static p256(username: string, pemRepresentation: string): SSHAuthenticationMethod | nullCreates a P-256 (ECDSA) authentication method from a PEM-formatted private key.
username (string):
The username for SSH login.
pemRepresentation (string):
The PEM-formatted private key string for ECDSA P-256.
SSHAuthenticationMethod, or null if the PEM is not valid.static p384(username: string, pemRepresentation: string): SSHAuthenticationMethod | nullCreates a P-384 (ECDSA) authentication method using a PEM-formatted private key.
username (string):
The SSH username.
pemRepresentation (string):
The PEM-formatted private key string.
SSHAuthenticationMethod, or null if the PEM format is invalid.static p521(username: string, pemRepresentation: string): SSHAuthenticationMethod | nullCreates a P-521 (ECDSA) authentication method using a PEM-formatted private key.
username (string):
The SSH username.
pemRepresentation (string):
The PEM-formatted private key string.
SSHAuthenticationMethod, or null if the PEM format is invalid.